package com.shemy.controller;

import com.shemy.entity.SysUser;
import com.shemy.service.SysUserService;
import com.shemy.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @Description
 * @Author Dzsom
 * @Date 2019-05-08 14:32
 * @Encoding UTF-8
 * @Version 1.0
 **/
@Controller
@RequestMapping("/user")
public class SysUserController {
    @Autowired
    private SysUserService sysUserService;

    @GetMapping("/select")
    @ResponseBody
    public Result list(){
        List<SysUser> users = sysUserService.findByAll();
        return new Result(true,200,"查询成功！",users);
    }

    @GetMapping("/add")
    public ModelAndView add(){
        return new ModelAndView("add");
    }
    @GetMapping("/delete")
    public ModelAndView delete(){
        return new ModelAndView("delete");
    }
    @GetMapping("/update")
    public ModelAndView update(){
        return new ModelAndView("update");
    }
}
